<include file="../Public/header" />

    <link href="__PUBLIC__/themes/blue/layout.css" rel="stylesheet" type="text/css" />
    
</head>


<script type="text/javascript" src="__PUBLIC__/js/tbox/tbox.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/admin.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-admin-box.js"></script>

<script>
	// tbox用常量
	var THEME = "__THEME__";
	var APP    = "__APP__";
	var URL    = "__URL__";
	var PUBLIC = "../Public";
	var SITE_URL = "{*SITE_URL}";
	
//全选,全不选，反选
var idField = 'checkboxIds';
function checkall(type){
	 //全选
	if(type=='all'){ 
	    $("input[id='"+idField+"']").each(function() {
	       $(this).attr("checked", true);    
	    });	
	//全不选
	}else if(type=='noall'){  
		$("input[id='"+idField+"']").each(function() {
				$(this).attr("checked", false);    
		});		
	//反选
	}else {
		$("input[id='"+idField+"']").each(function() {
				var aa = $(this).attr("checked");
				
				if(aa==false) $(this).attr("checked", true); 
				else          $(this).attr("checked", false);    
		});		
	}
}	

function getSelectValues() {
	id = [];	
	$("input[id='"+idField+"']").each(function() {     
			var aa = $(this).attr("checked");
			
			if(aa==true) {id.push( $(this).val() ); }
	});		
	return id.join(',');
}

function outExcel(){
//	var id = getSelectValues();
//	if(id==''||id=='undefined'){
//		alert('请选择需要导出的投票');
//		return false;
//	}
	
	var url = "{:U('admin/System/securityExcel')}";
	window.location.href = url;
}
</script>

<body>
<div id="container_s">
	<!-- 搜索位 BEGIN -->
	<form  action="{:U('admin/System/security')}" method="POST">
		<table class="tableborder" width="100%" id="search">
		  <tbody>
			<tr class="top">
			  <td class="border" colspan="2">
			  </td>
			</tr>
			<tr onclick="$('#search .cell').toggle();">
			  <th class="header" colspan="2">筛选条件</th>
			</tr>
			<tr class="label cell">
			  <th>说明</th>
			  <th>条件</th>
			</tr>

			<tr class="cell">
			  <td class="altbg1">
				<b>数据ID</b><br/>
				<span class="smalltxt">搜索指定的数据</span>
			  </td>
			  <td class="altbg2">
				<input name="id" class="txt" value="{$id}"/> [ 注：多条数据时请以英文的“,”分割 ]
			  </td>
			</tr>

			<tr class="cell">
			  <td class="altbg1">
				<b>应用</b><br/>
				<span class="smalltxt">应用名称</span>
			  </td>
			  <td class="altbg2">
				<input name="app" class="txt" value="{$app}"/> [ 注：多个应用时请以英文的“,”分割 ]
			  </td>
			</tr>

			<tr class="cell">
			  <td class="altbg1">
				<b>模块</b><br/>				
				<span class="smalltxt">模块名</span>
			  </td>
			  <td class="altbg2"><input name="mod" class="txt" value="{$mod}"/> [ 注：多个模块时以英文的“,”分割 ]</td>
			</tr>

			<tr class="cell">
			  <td class="altbg1">
				<b>操作</b><br/>				
				<span class="smalltxt">操作名称</span>
			  </td>
			  <td class="altbg2"><input name="act" class="txt" value="{$act}"/> [ 注：多个操作时以英文的“,”分割 ]</td>
			</tr>

			<tr class="cell">
			  <td class="altbg1">
				<b>类型</b><br/>
				<span class="smalltxt">类型</span>
			  </td>
			  <td class="altbg2">
				<select name="type">
					<option value="ALL"  <eq name="type" value="ALL">selected</eq>>所有</option>
					<option value="GET"  <eq name="type" value="GET">selected</eq>>GET</option>
					<option value="POST" <eq name="type" value="POST">selected</eq>>POST</option>
				</select>
			  </td>
			</tr>

			<tr class="cell">
			  <td class="altbg1">
				<b>是否ignored</b><br/>
				<span class="smalltxt">是否ignored</span>
			  </td>
			  <td class="altbg2">
				<select name="ignored">
					<option value="2" <eq name="ignored" value="2">selected</eq>>所有</option>
					<option value="0" <eq name="ignored" value="0">selected</eq>>否</option>
					<option value="1" <eq name="ignored" value="1">selected</eq>>是</option>
				</select>
			  </td>
			</tr>

			<tr class="cell">
			  <td class="altbg1">
				<b>结果排序</b><br/>
			  </td>
			  <td class="altbg2">
				<select name="field">
				  <option value="cTime" <eq name="field" value="cTime">selected</eq>>按发起时间排序</option>
				  <option value="app" <eq name="field" value="app">selected</eq>>按应用排序</option>
				  <option value="type" <eq name="field" value="type">selected</eq>>按类型排序</option>
				  <option value="key" <eq name="field" value="key">selected</eq>>按参数名排序</option>
				  <option value="group_flag" <eq name="field" value="group_flag">selected</eq>>按分组排序</option>
				</select>

				<select name="order">
				  <option value="DESC" <eq name="order" value="DESC">selected</eq>>降序</option>
				  <option value="ASC" <eq name="order" value="ASC">selected</eq>>升序</option>
				</select>
	   
				<select name="limit">
				  <option value="20" <eq name="limit" value="20">selected</eq>>每页显示20条</option>
				  <option value="50" <eq name="limit" value="50">selected</eq>>每页显示50条</option>
				  <option value="100" <eq name="limit" value="100">selected</eq>>每页显示100条</option>
				</select>
			  </td>
			</tr>

			<tr class="cell">
				<td>&nbsp;</td>
				<td class="pt10 pb10"><input type="submit" class="button" value="提交" /></td>
			</tr>
		  </tbody>
		</table>
	</form>
	<!-- 搜索位 END -->
	
	<!-- 正文 BEGIN -->
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder" id="checkList">
		<tbody>
			<!-- 列表标题 -->
			<tr class="top">
				<td class="border" colspan="12"></td>
			</tr>
			<tr>
				<th class="header" colspan="12"> GET/POST数据列表 </th>
			</tr>

			<!-- 列表字段 -->
			<tr class="label cell">
				<th>&nbsp;</th>
				<th>ID</th>
				<th>app</th>
				<th>mod</th>
				<th>act</th>
				<th>type</th>
				<th>key</th>
				<th>value</th>
				<th>是否ignored</th>
				<th>注释</th>
				<th>分组</th>
				<th>创建时间</th>
			</tr>
			
			<!-- 列表数据 -->
			<volist name="data" id='vo'>
			<tr id="list_{$vo.id}" class="cell">
				<td><!--<label><input type="checkbox" class="security_admin_check" rel="0" dataId="{$vo['id']}"></label>--></td>
				<td>{$vo.id}</td>
				<td>{$vo.app}</td>
				<td>{$vo.mod}</td>
				<td>{$vo.act}</td>
				<td>{$vo.type}</td>
				<td>{$vo.key}</td>
				<td>{$vo.value|getShort=50}</td>
				<td><eq name="vo['ignored']" value="0">否<else/>是</eq></td>
				<td><empty name="vo['notes']">暂无<else/>{$notes}</empty></td>
				<td>{$vo.group_flag}</td>
				<td>{$vo.cTime}</td>
			</tr>
			</volist>

			<tr>
				<td class="footer" colspan="12">
					<!--
					<button type="button" onclick="checkall('all')" class="btn_sea">全选</button>
					<button type="button" onclick="checkall('noall')"  class="btn_sea">全不选</button>
					<button type="button" onclick="checkall('')" class="btn_sea">反选</button>
					-->
					<button type="button" onclick="outExcel()" class="btn_sea">全部导出Excel</button>
				</td>
			</tr>

			<tr>
				<td class="footer" colspan="12">
					<div class="page mt5 alR mb20" style="float:right;">{$html}</div>
				</td>
			</tr>

			<tr class="bottom">
				<td class="border" colspan="12"></td>
			</tr>

		</tbody>
	</table>
	<!-- 正文 END -->
</div>

<!-- 前台管理 BEGIN -->
<div id="security_admin" style="display:none;">
	<a href="javascript:void(0)" onclick="ignore()">忽略/不忽略</a>
</div>
<!-- 前台管理 END -->

<!-- 页面JS BEGIN -->
<script type="text/javascript">
	//加载前台管理工具
	$(function(){
		$.fn.admin({
			prefix:'security_',
			checkClass:'security_admin_check',
			hiddenId:'security_admin',
			lMinOffset:1,
			type:false,
			position:'right'
		});
	});

	//忽略
	function ignore() {
		if(confirm('确认忽略/不忽略吗？')){
			$.post("{:U('admin/System/doIgnoreSecurity')}", {id:$.fn.getData('security_')}, function(result){
				if(result == 1) {
					$.tbox.yes('保存成功',"提示");
					setTimeout("$.tbox.close()",1500);
					$.each($.fn.getData('security_'),function(i,n){
						$("#list_"+n).remove();
					});
					$('#security_admin_box').hide();
				}else{
					$.tbox.no('保存失败',"提示");
					setTimeout("$.tbox.close()",1500);
				}
			});
		}
	}
</script>
<!-- 页面JS END -->

</body>
</html>